home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d15 / mewin.arc / FORTRAN.CMD < prev    next >
OS/2 REXX Batch file  |  1991-03-12  |  2KB  |  96 lines

  1. ; fortran.cmd,  emacs,  31 Jan 90,  S.D. Maley
  2. ; Fortran convention support under MicroEmacs 3.10 and later
  3. ;
  4. set %sindent 6        ;-- indentation for Fortran statements
  5.             ; align with handle-tab, if you change it
  6. 72 set-fill-column
  7. 2 handle-tab        ;-- 2 is a modest tab setting, change if you like
  8.  
  9. bind-to-key execute-macro-36 c
  10. ; bind-to-key execute-macro-35 " "  ;-- too SLOW !!
  11. bind-to-key execute-macro-34 ^I
  12.  
  13. set $wraphook execute-macro-33
  14. set %indent %sindent
  15.  
  16. ;;   when comments must be upper-case ...
  17. 36 store-macro
  18.     !if &equ $curcol 0
  19.         insert-string "C"
  20.     !else
  21.         insert-string "c"
  22.     !endif
  23. !endm
  24.  
  25. ;;   handle indentation
  26. 35 store-macro
  27.     !if &less $curcol %sindent
  28.         execute-procedure find-indent
  29.         execute-procedure indent
  30.     !else
  31.         !if &less $fillcol $curcol
  32.             $wraphook
  33.         !endif
  34.         insert-string " "
  35.     !endif
  36. !endm
  37.  
  38. ;;   handle tabs
  39. 34 store-macro
  40.     !if &less $curcol %sindent
  41.         execute-procedure find-indent
  42.         execute-procedure indent
  43.     !else
  44.         !if &less $fillcol $curcol
  45.             $wraphook
  46.         !endif
  47.         handle-tab
  48.     !endif
  49. !endm
  50.  
  51. ;;   wraparound
  52. 33 store-macro
  53.     wrap-word
  54.     execute-procedure find-indent
  55.         set $curcol 0
  56.     !if &sequ %indfollows "C"
  57.         insert-string "C"
  58.     !else
  59.         insert-string "     +"
  60.     !endif
  61.     set %indent &sub %indent $curcol
  62.     execute-procedure indent
  63.     end-of-line
  64. !endm
  65.  
  66. store-procedure find-indent
  67.     ;-- find out the indentation
  68.     !if &equ $curline 1
  69.         set %indent %sindent
  70.         set %indfollows " "
  71.     !else
  72.         set %curline $curline
  73.         set %curcol $curcol
  74.         beginning-of-line
  75.         previous-line
  76.         set %indfollows &chr $curchar
  77.         !if &less $lwidth %sindent
  78.             set %indent %sindent
  79.         !else
  80.             set $curcol 6    ; past insignificance
  81.             !while &equ $curchar 32    ;-- white space
  82.                 forward-character
  83.             !endwhile
  84.             set %indent $curcol
  85.         !endif
  86.         set $curline %curline
  87.         set $curcol %curcol
  88.     !endif
  89. !endm
  90.  
  91. store-procedure indent
  92.     !if &less 0 %indent
  93.         %indent insert-string " "
  94.     !endif
  95. !endm
  96.